package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionFactory {
	
	public Connection getConnection() {
//		try {
//			return DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "admin");	
//		} catch (SQLException e) {
//			throw new RuntimeException(e);
//		}
		
		
		Connection cnn = null;
        System.out.println("Conectando ao banco");  
		try {  
  
            Class.forName("org.postgresql.Driver");  
            cnn = DriverManager.getConnection(  
                    "jdbc:postgresql://localhost:5432/postgres", "postgres", "admin");  
  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
		return cnn; 
	}
}
